DBGrid, barveni radku
Otázka od: In g. Zdenek Reznicek
23. 11. 2004 0:14
Poradte mi nekdo prosim DBGrid, ktery umi barveni radku.
Diky Zdenek
Odpovedá: horky@cominn.cz
23. 11. 2004 8:32
> From: In g. Zdenek Reznicek [mailto:reznicek@pce.cz]
> Sent: Tuesday, November 23, 2004 12:14 AM
> Poradte mi nekdo prosim DBGrid, ktery umi barveni radku.
Dela se to pomoci uzivatelskeho vykreslovani, toto je jedno z reseni, meni to
barvu pozadi podle hodnoty v sloupci:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if not(gdSelected in State) then
case Table1.FieldByName('NumTickets').AsInteger of
0 : TDBGrid(Sender).Canvas.Brush.Color := clYellow;
1 : TDBGrid(Sender).Canvas.Brush.Color := clGray;
2 : TDBGrid(Sender).Canvas.Brush.Color := clSilver;
3 : TDBGrid(Sender).Canvas.Brush.Color := clRed;
4 : TDBGrid(Sender).Canvas.Brush.Color := clGreen;
end;
TDBGrid(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
--
S pozdravem Karel Horky, D7, FB 1.0.3, IBX 7.08, WXP SP1
[mailto:horky@cominn.cz]
Odpovedá: Libor Janecek
23. 11. 2004 16:20
TJvDBGrig - OnGetCellParams
Libor.J
>Poradte mi nekdo prosim DBGrid, ktery umi barveni radku.
>Diky Zdenek